<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input v-model="listQuery.title" size="medium" placeholder="激活码" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />

      <el-button v-waves class="filter-item" type="primary" size="medium" icon="el-icon-search" @click="handleFilter">
        搜索
      </el-button>

      <div class="block">
        <el-table
          :data="tableData"
          style="width: 100%;margin-bottom: 20px;"
          row-key="id">
<!--          <el-table-column-->
<!--            prop="id"-->
<!--            label="ID"-->
<!--            width="80">-->
<!--          </el-table-column>-->
          <el-table-column
            prop="activate_code"
            label="激活码">
          </el-table-column>
          <el-table-column
            prop="equipment"
            label="设备">
          </el-table-column>
          <el-table-column
            prop="activate_at"
            label="激活时间">
          </el-table-column>
        </el-table>
      </div>
    </div>
    <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
  </div>
</template>

<script>
import waves from '@/directive/waves'
import Pagination from '@/components/Pagination'
import { getActivateLog } from '@/api/activate'
export default {
  name: 'ActivateLog',
  components: { Pagination },
  directives: { waves },
  data() {
    return {
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 20,
        title: undefined
      },
      tableData: []
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      getActivateLog(this.listQuery).then(response => {
        if (response.code === 200) {
          this.tableData = response.data.rows
          this.total = response.data.total
        }
        this.resetTemp()
      })
    },
    handleFilter() {
      this.getList()
    },
  }
}
</script>

<style scoped>

</style>
